// 节点加载后执行
window.onload = function() {
	// 获取每个小标框
	const block = document.querySelectorAll('#Arrangement>div');
	// 添加点击事件
	for (let i = 0; i < block.length; i++) {
		block[i].onclick = getBlock;
	}
	// 页面跳转的
	function getBlock(e) {
		localStorage.setItem('text', this.children[1].innerText);
		console.log(window.location);
		window.location.href = 'son/template.html';
	}
	// 轮播实现
	// 图片路径
	const imgs = ['./img/tit1.jpg', './img/tit2.jpg', './img/tit3.jpg', './img/tit4.jpg', './img/tit5.jpg',
		'./img/tit6.jpg', './img/tit7.jpg', './img/tit8.jpg', './img/tit9.jpg', './img/tit10.jpg'
	];
	box.style.backgroundSize = '100% 100%'; 
	// 记录轮播到哪的位置标
	let treetop = 0;
	// 定时器
	let time = setInterval(() => {
		if (treetop == 10) {
			treetop = 0;
		}
		box.style.backgroundImage='url(' + imgs[treetop] + ')';
		block.forEach((itm, ind) => {
			if (treetop == ind) {
				itm.classList.add('activate2');
			} else {
				itm.classList.remove('activate2');
			}
		
		})
		treetop++;
		console.log(box.style.backgroundImage);
	}, 1500);
}
